package com.controller;

import com.entity.dto.BindTableCheckRuleDto;
import com.entity.dto.BindTableColumnCheckRuleDto;
import com.service.DataQualityService;
import com.util.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@Api(tags = "数据质量-规则绑定")
@RequestMapping("/schema")
@RestController
public class DataQualityController {

    @Resource
    private DataQualityService dataQualityService;

    @ApiOperation(value = "表级-规则绑定")
    @GetMapping("/bindTableCheckRules")
    public R<Boolean> bindTableCheckRules(@RequestBody List<BindTableCheckRuleDto> ruleDtos){
        dataQualityService.bindTableCheckRules(ruleDtos);
        return R.ok();
    }

    @ApiOperation(value = "表字段-规则绑定")
    @GetMapping("/bindColumnCheckRules")
    public R<Boolean> bindColumnCheckRules(@RequestBody List<BindTableColumnCheckRuleDto> ruleDtos){
        dataQualityService.bindColumnCheckRules(ruleDtos);
        return R.ok();
    }


}
